<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\Request;

class PhotoRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'pcontent'=>'required|unique:photo',
            'ppath'=>'required|unique:photo',
            'porder'=>'required|unique:photo',
            'plink'=>'required',
        ];
    }

    public function messages()
    {
        return  [
            'pcontent.required' => '标题必须填写',
            'pcontent.unique' => '标题已存在',
            'ppath.required' => '轮播图不能为空',
            'ppath.unique' => '轮播图已存在',
            'porder.required' => '轮播图排序不能为空',
            'porder.unique' => '轮播图已经在',
            'plink.required' => '链接不能为空',
        ];
    }
}
